<?php include "htmlBase/header.php"; ?>


<?php
include_once 'Entidades/EntidadeBase.php';
include_once 'Entidades/ComposicaoFamiliar.php';
$servicoComposicaoFamiliar = new ComposicaoFamiliar();
$ComposicaoFamiliar = isset($_GET["Id"]) ? $servicoComposicaoFamiliar->ObterPorId($_GET["Id"]) : new ComposicaoFamiliar();

if ($ComposicaoFamiliar->Id == 0)
{
    $ComposicaoFamiliar->id_Responsavel = $_GET["id_Responsavel"];
}

include_once 'Controles/ComboBox.php';
?>

<script>
    $(document).ready
    (
    function () 
    { 
			
             
        $("input[name = 'DataNascimento']").datepicker(
        {
            changeMonth: true,
            changeYear: true
        });
    }
    
)
    
    $(document).ready
    (
    function () 
    { 
        $("input[name = 'Salario']").spinner(
        {
            min: 0,
            max: 999999,
            step: 100,
            start: 0,
            numberFormat: "n"
        });
    }
)
    
    function Validar_Form(form)
    {
<?php
{
    $ComposicaoFamiliar->getJavaScriptCamposObrigatoriosInput();
}
?>
      
        return true;
    }
</script>

<div class="page">
    <div class="page-header">
        <div class="page-header-content">
            <h1>Composição Familiar <small>(Cadastro)</small></h1>
        </div>
        <div class="progress-bar" align="rigth">
            <div class="bar bg-color-blue" style="width: 75%"></div>
        </div>
    </div>
    <br/>
    <div class="page secondary">
        <div class="page-region">
            <div class="page-region-content">

                <form action="ComposicaoFamiliarDados.php" method="POST" onsubmit="return Validar_Form(this)">
                    <input type="hidden" class="with-helper" name="Id" value="<?php echo $ComposicaoFamiliar->Id; ?>"/>
                    <input type="hidden" class="with-helper" name="id_Responsavel" value="<?php echo $ComposicaoFamiliar->id_Responsavel; ?>"/>


                    <div class="grid">
                        <div class="row">
                            <div class="span5">
                                <div class="input-control text">
                                    <h4>Nome</h4>
                                    <input type="text" class="with-helper" placeholder="Nome" name="Nome" value="<?php echo $ComposicaoFamiliar->Nome; ?>"/>
                                </div>
                            </div>

                            <div class="span2">
                                <div class="input-control text">
                                    <h4>Parentesco</h4>
                                    <?php
                                    ComboBox("Parentesco", "Parentesco", $ComposicaoFamiliar->Parentesco);
                                    ?>
                                </div>
                            </div>

                            <div class="span3">
                                <div class="input-control text">
                                    <h4>Estado Civil</h4>
                                    <?php
                                    ComboBox("EstadoCivil", "EstadoCivil", $ComposicaoFamiliar->EstadoCivil);
                                    ?>
                                </div>
                            </div>

                        </div>

                        <div class="row">
                            <div class="span3">
                                <div class="input-control text">
                                    <h4>Data de Nascimento</h4>
                                    <input type="text" class="with-helper" placeholder="Data de Nascimento" name="DataNascimento" value="<?php echo $ComposicaoFamiliar->DataNascimento; ?>"/>
                                </div>
                            </div>

                            <div class="span3">
                                <div class="input-control text">
                                    <h4>Instrução</h4>
                                    <?php ComboBox("Instrucao", "Instrucao", $ComposicaoFamiliar->Instrucao); ?>
                                </div>
                            </div>

                            <div class="span4">
                                <div class="input-control text">
                                    <h4>Escola</h4>
                                    <input type="text" class="with-helper" placeholder="Escola" name="Escola" value="<?php echo $ComposicaoFamiliar->Escola; ?>"/>
                                </div>
                            </div>
                        </div>



                        <div class="row">
                            <div class="span7">
                                <div class="input-control text">
                                    <h4>Ocupação</h4>
                                    <input type="text" class="with-helper" placeholder="Ocupação" name="Ocupacao" value="<?php echo $ComposicaoFamiliar->Ocupacao; ?>"/>
                                </div>
                            </div>

                            <div class="span3">
                                <div class="input-control text">
                                    <h4>Salário</h4>
                                    <input type="text" placeholder="Salário" name="Salario" value="<?php echo $ComposicaoFamiliar->Salario; ?>" style="text-align: right"/>
                                </div>
                            </div>

                        </div>
                    </div>
            </div>

            <div class="input-control" style="width: 60%; margin-left: auto; margin-right: auto;">
                <input type="hidden" class="with-helper" name="Id" value="<?php echo $ComposicaoFamiliar->Id; ?>"/>
                <input type="hidden" class="with-helper" name="id_Responsavel" value="<?php echo $ComposicaoFamiliar->id_Responsavel; ?>"/>
            </div>

            <br/>

            <div class="input-control" style="margin-left: auto; margin-right: auto;">
                <button class="standart default" type="submit">Salvar</button>
                <a href="ComposicaoFamiliarCadastro.php?id_Responsavel=<?php echo $ComposicaoFamiliar->id_Responsavel; ?>" class="button standart">Novo</a>
                <?php
                if ($ComposicaoFamiliar->Id != 0)
                {
                    ?>
                    <a href="ComposicaoFamiliarCadastro.php?Id=<?php echo $ComposicaoFamiliar->Id; ?>" class="button standart">Cancelar</a>
                    <?php
                }
                ?>

                <a href="ComposicaoFamiliarPesquisa.php?id_Responsavel=<?php echo $ComposicaoFamiliar->id_Responsavel; ?>" class="button standart bg-color-lighten" style="float: right">Lista</a>
            </div>

            </form>
        </div>
    </div>
</div>

</div>

<?php include "htmlBase/footer.php"; ?>